package com.hacpai.android.md.model.entity;

import com.google.gson.annotations.SerializedName;

import com.hacpai.android.md.model.api.ApiDefine;
import com.hacpai.android.md.util.FormatUtils;
import org.joda.time.DateTime;

import java.util.List;

public class Article extends ArticleSimple {

    private  String articleAudioURL;

    private String articleAuthorId;

    @SerializedName("author_name")
    private String articleAuthorName;

    private List<Tag> articleTagObjs;

    private String articleContent;

    private int articleBadCnt ;

    private int articleCollectCnt ;

    private int articleCommentCount;

    private long articleCreateTime ;

    private int articleGoodCnt;

    private int articlePerfect;

    private String articlePermalink;

    private String articlePreviewContent ;

    private int articleStick;

    private int articleStickRemains;

    private String articleTags;

    private String articleThumbnailURL;

    private String articleTitleEmoj;

    private int articleType;

    private String articleUA;

    private long articleUpdateTime;

    private int articleViewCount;

    private int articleWatchCnt;

    private int paginationPageCount ;

    private int paginationRecordCount;

    private String timeAgo;

    public String getArticleAudioURL() {
        return articleAudioURL;
    }

    public void setArticleAudioURL(String articleAudioURL) {
        this.articleAudioURL = articleAudioURL;
    }

    public String getArticleAuthorId() {
        return articleAuthorId;
    }

    public void setArticleAuthorId(String articleAuthorId) {
        this.articleAuthorId = articleAuthorId;
    }

    public String getArticleAuthorName() {
        return articleAuthorName;
    }

    public void setArticleAuthorName(String articleAuthorName) {
        this.articleAuthorName = articleAuthorName;
    }

    public String getArticleContent() {
        return articleContent;
    }

    public void setArticleContent(String articleContent) {
        this.articleContent = articleContent;
        contentHtml = null; // 清除已经处理的Html渲染缓存
    }

    public List<Tag> getArticleTagObjs() {
        return articleTagObjs;
    }

    public void setArticleTagObjs(List<Tag> articleTagObjs) {
        this.articleTagObjs = articleTagObjs;
    }

    public int getArticleBadCnt() {
        return articleBadCnt;
    }

    public void setArticleBadCnt(int articleBadCnt) {
        this.articleBadCnt = articleBadCnt;
    }

    public int getArticleCollectCnt() {
        return articleCollectCnt;
    }

    public void setArticleCollectCnt(int articleCollectCnt) {
        this.articleCollectCnt = articleCollectCnt;
    }

    public int getArticleCommentCount() {
        return articleCommentCount;
    }

    public void setArticleCommentCount(int articleCommentCount) {
        this.articleCommentCount = articleCommentCount;
    }

    public long getArticleCreateTime() {
        return articleCreateTime;
    }

    public void setArticleCreateTime(long articleCreateTime) {
        this.articleCreateTime = articleCreateTime;
    }

    public int getArticleGoodCnt() {
        return articleGoodCnt;
    }

    public void setArticleGoodCnt(int articleGoodCnt) {
        this.articleGoodCnt = articleGoodCnt;
    }

    public int getArticlePerfect() {
        return articlePerfect;
    }

    public void setArticlePerfect(int articlePerfect) {
        this.articlePerfect = articlePerfect;
    }

    public String getArticlePermalink() {
        return articlePermalink;
    }

    public void setArticlePermalink(String articlePermalink) {
        this.articlePermalink = articlePermalink;
    }

    public String getArticlePreviewContent() {
        return articlePreviewContent;
    }

    public void setArticlePreviewContent(String articlePreviewContent) {
        this.articlePreviewContent = articlePreviewContent;
    }

    public int getArticleStick() {
        return articleStick;
    }

    public void setArticleStick(int articleStick) {
        this.articleStick = articleStick;
    }

    public int getArticleStickRemains() {
        return articleStickRemains;
    }

    public void setArticleStickRemains(int articleStickRemains) {
        this.articleStickRemains = articleStickRemains;
    }

    public String getArticleTags() {
        return articleTags;
    }

    public void setArticleTags(String articleTags) {
        this.articleTags = articleTags;
    }

    public String getArticleThumbnailURL() {
        return articleThumbnailURL;
    }

    public void setArticleThumbnailURL(String articleThumbnailURL) {
        this.articleThumbnailURL = articleThumbnailURL;
    }

    public String getArticleTitleEmoj() {
        return articleTitleEmoj;
    }

    public void setArticleTitleEmoj(String articleTitleEmoj) {
        this.articleTitleEmoj = articleTitleEmoj;
    }

    public int getArticleType() {
        return articleType;
    }

    public void setArticleType(int articleType) {
        this.articleType = articleType;
    }

    public String getArticleUA() {
        return articleUA;
    }

    public void setArticleUA(String articleUA) {
        this.articleUA = articleUA;
    }

    public long getArticleUpdateTime() {
        return articleUpdateTime;
    }

    public void setArticleUpdateTime(long articleUpdateTime) {
        this.articleUpdateTime = articleUpdateTime;
    }

    public int getArticleViewCount() {
        return articleViewCount;
    }

    public void setArticleViewCount(int articleViewCount) {
        this.articleViewCount = articleViewCount;
    }

    public int getArticleWatchCnt() {
        return articleWatchCnt;
    }

    public void setArticleWatchCnt(int articleWatchCnt) {
        this.articleWatchCnt = articleWatchCnt;
    }

    public int getPaginationPageCount() {
        return paginationPageCount;
    }

    public void setPaginationPageCount(int paginationPageCount) {
        this.paginationPageCount = paginationPageCount;
    }

    public int getPaginationRecordCount() {
        return paginationRecordCount;
    }

    public void setPaginationRecordCount(int paginationRecordCount) {
        this.paginationRecordCount = paginationRecordCount;
    }

    public String getTimeAgo() {
        return timeAgo;
    }

    public void setTimeAgo(String timeAgo) {
        this.timeAgo = timeAgo;
    }

    /**
     * Html渲染缓存
     */

    @SerializedName("content_html")
    private String contentHtml;

    public String getContentHtml() {
        if (contentHtml == null) {
            if (ApiDefine.MD_RENDER) {
                contentHtml = FormatUtils.handleHtml(articleContent);
            } else {
                contentHtml = FormatUtils.handleHtml(FormatUtils.renderMarkdown(articleContent));
            }
        }
        return contentHtml;
    }

}
